home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #1
/
Amiga Plus CD - 2000 - No. 1.iso
/
c
/
quitlav.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-12-03
|
775b
|
40 lines
#include <exec/exec.h>
#include <clib/exec_protos.h>
#include "lavd.h"
static const char PortName[] = "lavd";
struct MsgPort *lavdPort = NULL;
struct MsgPort *RepPort = NULL; /* Reply port. */
lavdMsg Req;
main()
{
if ((RepPort = CreateMsgPort()) == NULL) {
PutStr("Couldn't create a message port.\n");
goto exitmain;
}
Req.lm_Message.mn_ReplyPort = RepPort;
Req.lm_Message.mn_Length = sizeof(lavdMsg);
Req.Class = LAV_STOP;
/* Forbid so the port doesn't go away... */
Forbid();
if ((lavdPort = FindPort(PortName)) == NULL) {
Permit();
PutStr("Demon not running.\n");
goto exitmain;
}
PutMsg (lavdPort, &Req);
Permit();
WaitPort(RepPort); /* Wait for the reply. */
exitmain:
if (RepPort != NULL) {
DeleteMsgPort(RepPort);
}
exit(0);
}